package com.ap.core.common.types;

import com.ap.core.cxf.jaxb.msghdr.MessageType;
import com.ap.core.cxf.jaxb.paymentdetails.TransactionStatusCode;
import com.ap.core.cxf.jaxb.paymentdetails.TxnStatusDescType;

/**
 * User: Ranjit.Singh
 */
public enum PaymentResponseStatusType {

    A01(TxnStatusDescType.DECLINED),
    A02(TxnStatusDescType.DECLINED),
    A03(TxnStatusDescType.PROCESSINGERROR),
    A04(TxnStatusDescType.PROCESSINGERROR),
    A05(TxnStatusDescType.DECLINED),
    A06(TxnStatusDescType.PROCESSINGERROR),
    A07(TxnStatusDescType.PROCESSINGERROR),
    A08(TxnStatusDescType.DECLINED);

    
    private TxnStatusDescType txnStatusDescType;

  

    private PaymentResponseStatusType(TxnStatusDescType txnStatusDescType) {
      this.txnStatusDescType = txnStatusDescType;
    }

   

    public static TxnStatusDescType getMessageType(TransactionStatusCode transactionStatusCode) {

    	PaymentResponseStatusType paymentResponseStatusType = null;
        switch (transactionStatusCode) {
            case A_01:
            	paymentResponseStatusType = PaymentResponseStatusType.A01;
                break;
            case A_02:
            	paymentResponseStatusType = PaymentResponseStatusType.A02;
                break;
            case A_03:
            	paymentResponseStatusType = PaymentResponseStatusType.A03;
                break;
            case A_04:
            	paymentResponseStatusType = PaymentResponseStatusType.A04;
                break;
            case A_05:
            	paymentResponseStatusType = PaymentResponseStatusType.A05;
                break;
            case A_06:
            	paymentResponseStatusType = PaymentResponseStatusType.A06;
                break;
            case A_07:
            	paymentResponseStatusType = PaymentResponseStatusType.A07;
                break;
            case A_08:
            	paymentResponseStatusType = PaymentResponseStatusType.A08;
                break;                
            default:
                // not found
                throw new IllegalArgumentException("Unable to determine message type: paymentResponseStatusType= " + paymentResponseStatusType);
        }
        return paymentResponseStatusType.txnStatusDescType;
    }


}
